class Solution {
public:
    bool containsNearbyDuplicate(vector<int>& nums, int k) {
        unordered_map<int, int>st;
        for (int i = 0; i < nums.size(); i++)
        {
            if (st.count(nums[i]))
            {

                if (i - st[nums[i]] <= k)return true;

            }
            st[nums[i]] = i;






        }
        return false;

    }
};/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    int dfs(TreeNode* root, int presum)
    {
        presum = presum * 10 + root->val;
        if (root->left == nullptr && root->right == nullptr)
            return presum;
        int ret = 0;
        if (root->left)ret += dfs(root->left, presum);
        if (root->right)ret += dfs(root->right, presum);
        return ret;

    }




    int sumNumbers(TreeNode* root) {

        return dfs(root, 0);



    }
}; class Solution {
public:
    bool isIsomorphic(string s, string t) {
        char mark1[150] = { 0 };
        char mark2[150] = { 0 };
        for (int i = 0; i < s.size(); i++)
        {
            if (mark1[s[i]] == 0 && mark2[t[i]] == 0)
            {
                mark1[s[i]] = t[i];
                mark2[t[i]] = s[i];
            }
            else if (mark1[s[i]] != t[i] || mark2[t[i]] != s[i])
            {
                return false;
            }






        }
        return true;









    }
};